package leo.game.ui
{
	import flash.display.Sprite;
	/**
	 * 防守塔攻击范围 
	 * @author leo
	 * 
	 */	
	public class TowerAttackRange extends Sprite
	{
		private var mc :Sprite;
		private var oldValue :int;
		public function TowerAttackRange()
		{
			super();
			init();
		}
		/**
		 * 初始化 
		 * 
		 */		
		private function init():void
		{
			mc = new Sprite();
			this.addChild(mc);
		}
		/**
		 * 显示防守塔范围 
		 * @param range
		 * 
		 */		
		public function showRange(range :int = 50,tx :Number = 0,ty :Number = 0):void
		{
//			if(this.oldValue == range) return;
//			this.oldValue = range;
			if(!this.visible) this.visible = true;
			mc.graphics.clear();
			mc.graphics.lineStyle(2,0,0.5);
			mc.graphics.beginFill(0x5F9F9F,0.5);
			mc.graphics.drawCircle(0,0,range);
			mc.graphics.endFill();
			if(tx || ty)
			{
				this.x = tx;
				this.y = ty;
			}
		}
		/**
		 * 隐藏防守塔攻击范围 
		 * 
		 */		
		public function hideRange():void
		{
			mc.graphics.clear();
			this.visible = false;
		}
	}
}